package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

public class CollectionDemo {
    public static void main(String[] args)
    {
//        Collection c=new ArrayList();
        Collection c=new HashSet();
        /*
        boolean add(Object object)
         *
         */
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        boolean f=c.add("one");//重复元素无法存入set集合
        System.out.println(f);
        System.out.println(c);
        c.add(123);//c.add(Integer.valueOf(123));
        System.out.println(c);
        int size = c.size();
        System.out.println(size);
        boolean empty = c.isEmpty();
        System.out.println(c+"集合是否为空"+empty);
        c.clear();
        System.out.println(c);
        System.out.println(c.size());
        System.out.println(c.isEmpty());

    }
}
